<template>
	<view class="ys">
		<view class="list">

			<view class="item" v-for="(item,index) in list" :key="index" @click="toPage('./day?id='+item.id)">
				<view class="left">
					<view class="name">
						{{item.staff_name}}
					</view>
					<view class="time">
						{{item.create_time}}
					</view>
				</view>
				<view class="num">
					￥{{item.money}} {{item.type_name}}
				</view>
			</view>
		</view>
		<view class="no-list" v-if="list.length == 0">
			- 暂无数据 -
		</view>
	</view>
</template>

<script>
	import {
		dayIncome
	} from "@/api/user.js"
	export default {
		data() {
			return {
				list: [],
				date: ''
			}
		},
		onLoad(e) {
			if (e.date) {
				this.date = e.date
				this.dayIncome()
			}
		},
		methods: {
			dayIncome() {
				dayIncome({
					date: this.date
				}).then(res => {
					if (res.code == 0) {
						this.list = res.data
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		padding-top: 10px;
	}

	.list {
		padding: 0 2%;
		background: #fff;
		width: 96%;
		margin: 0 auto;
		border-radius: 10px;
		box-sizing: border-box;

		.item {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20px 10px;
			border-bottom: 1px solid #f2f2f2;

			.name {
				font-weight: bold;
				margin-bottom: 5px;
			}

			.time {
				color: #999;
				font-size: 14px;
			}
		}
	}
</style>